//
//  TableFootView.m
//  Normal
//
//  Created by 8b410-2 on 16/12/9.
//  Copyright © 2016年 abb. All rights reserved.
//

#import "TableFootView.h"
#import "UIButton+Common.h"
@implementation TableFootView

- (instancetype)initWithButtonTitle:(NSString *)title {
    self = [super initWithFrame:CGRectMake(0, 0, kScreen_Width, 94)];
    if (self) {
        _button = [UIButton buttonWithTitle:title
                                 TitleColor:[UIColor whiteColor]
                                   FontSize:18.0
                            BackgroundColor:themeColor];
        
        [self addSubview:_button];
        _button.translatesAutoresizingMaskIntoConstraints = NO;
        NSMutableArray *cons = [[NSMutableArray alloc] init];
        NSDictionary *viewDict = @{@"button" : _button};
        [cons addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[button]-20-|" options:0 metrics:nil views:viewDict]];
        NSString *spacing = [@(kScreen_Width * 0.1) stringValue];
        [cons addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-spacing-[button]-spacing-|" options:0 metrics:@{@"spacing":spacing} views:viewDict]];
        [self addConstraints:cons];
    }
    return self;
}
+ (TableFootView *)footViewWithButtonTitle:(NSString *)title {
    return [[TableFootView alloc] initWithButtonTitle:title];
}

@end
